123456789101112131415161718192021222324 |
- "use client";
- import { getGamesApi, GroupType } from "@/api/home";
- import { SwiperGroup } from "@/components/Card";
- import { FC, PropsWithChildren, useEffect, useState } from "react";
- import "swiper/css";
- interface Props {}
- const HomeSwiper: FC<PropsWithChildren<Props>> = (props) => {
- const [groupGames, setGroupGames] = useState<GroupType[]>([]);
- useEffect(() => {
- getGamesApi().then((res) => {
- setGroupGames(res.data);
- });
- }, []);
- return (
- <div>
- {!!groupGames &&groupGames.map((group, index) => {
- return <SwiperGroup key={index} group={group}></SwiperGroup>;
- })}
- </div>
- );
- };
- export default HomeSwiper;
|